<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="utf-8">
    <title>查询图书信息</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="layui/css/layui.css" media="all">
    <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
</head>
<body>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
    <legend>查询图书信息</legend>
</fieldset>

<form class="layui-form" action="byISBNServlet.do" method="post"><%--此表单提交到按ISBN查找的Servlet中 --%>
    <div class="layui-form-item">
        <label class="layui-form-label">按ISBN查找</label>
        <div class="layui-input-block">
            <input type="text" name="ISBN" lay-verify="required" lay-reqtext="查询ISBN为必填项，不能为空" autocomplete="off"
                   placeholder="请输入ISBN" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button type="submit" class="layui-btn layui-btn-warm" lay-submit="" lay-filter="demo1">立即查询</button>
            <button type="reset" class="layui-btn layui-btn-normal">重新填写</button>
        </div>
    </div>
</form>
<form class="layui-form" action="byNameServlet.do" method="post"><%--此表单提交到按姓名查找的Servlet中 --%>
    <div class="layui-form-item">
        <label class="layui-form-label">按书名查找</label>
        <div class="layui-input-block">
            <input type="text" name="name" lay-verify="required" lay-reqtext="查询书名为必填项，不能为空" autocomplete="off"
                   placeholder="请输入书名" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button type="submit" class="layui-btn layui-btn-warm" lay-submit="" lay-filter="demo1">立即查询</button>
            <button type="reset" class="layui-btn layui-btn-normal">重新填写</button>
        </div>
    </div>
</form>
<hr/>
<form class="layui-form" action="byAllServlet.do" method="post"><%--此表单提交到查找所有的图书信息的Servlet中 --%>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button type="submit" class="layui-btn layui-btn-warm" lay-submit="" lay-filter="demo1">查询所有图书信息</button>
        </div>
    </div>
</form>
<%--  以下为js动态交互部分，由于晦涩难懂就不做修改，全部复制--%>

<script src="layui/layui.js" charset="utf-8"></script>
<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script>
    layui.use(['form', 'layedit', 'laydate'], function () {
        var form = layui.form
            , layer = layui.layer
            , layedit = layui.layedit
            , laydate = layui.laydate;

        //日期
        laydate.render({
            elem: '#date'
        });
        laydate.render({
            elem: '#date1'
        });


        //监听指定开关
        form.on('switch(switchTest)', function (data) {
            layer.msg('开关checked：' + (this.checked ? 'true' : 'false'), {
                offset: '6px'
            });
            layer.tips('温馨提示：请注意开关状态的文字可以随意定义，而不仅仅是ON|OFF', data.othis)
        });

        //表单取值
        layui.$('#LAY-component-form-getval').on('click', function () {
            var data = form.val('example');
            alert(JSON.stringify(data));
        });

    });
</script>
</body>
</html>
